package com.book.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class AppListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
	
	System.out.println("AppListener contextInitialized ************");
	String contextPath = sce.getServletContext().getContextPath();
	String root = contextPath;
	sce.getServletContext().setAttribute("resroot",root);
	sce.getServletContext().setAttribute("approot",root);
	sce.getServletContext().setAttribute("resIndex",root + "/static/index");
	sce.getServletContext().setAttribute("imgUrlPrefix","http://192.168.0.103:88/ftp");
	
	System.out.println();
	
}
@Override
	public void contextDestroyed(ServletContextEvent sce) {
	
		System.out.println("AppListener contextDestroyed --------------------");
	}
	
	
}
